function initCarousel_html_carousel() {carousel = new Carousel('html-carousel', {animHandler:animHandler, animParameters:{duration:0.5}, buttonStateHandler:buttonStateHandler, nextElementID:'next-arrow', prevElementID:'prev-arrow', size:31})};

Event.observe(window, 'load', initCarousel_html_carousel);

function buttonStateHandler(button, enabled) {
 if(button == "prev-arrow") {
  $('prev-arrow').src = enabled ? "http://a121.g.akamai.net/f/121/21164/1d/content.fromyouflowers.com/images/layout/prev_arrow.png" : "http://a121.g.akamai.net/f/121/21164/1d/content.fromyouflowers.com/images/layout/prev_arrow_d.png"
 }
 else {
  $('next-arrow').src = enabled ? "http://a121.g.akamai.net/f/121/21164/1d/content.fromyouflowers.com/images/layout/next_arrow.png" : "http://a121.g.akamai.net/f/121/21164/1d/content.fromyouflowers.com/images/layout/next_arrow_d.png"
 }
}

function animHandler(carouselID, status, direction) {
 var region = $(carouselID).down(".carousel-clip-region")
 if(status == "before") {
  Effect.Fade(region, {to: 0.3, queue: { position:'end', scope: "carousel" }, duration: 0.2})
 }
 if(status == "after") {
  Effect.Fade(region, {to: 1, queue: { position:'end', scope: "carousel" }, duration: 0.2})
 }
}

function active_prod(prod_idx, is_active) {
 if(is_active) {
  document.getElementById("fprod" + prod_idx).className = "over";
 }
 else {
  document.getElementById("fprod" + prod_idx).className = "";
 }
}

jQuery(function($) {
 var timer = null;

 $('.slider dl dt').bind('activate mouseenter', function(e) {
  var $this = $(this);

  if ($this.hasClass('active')) {
   return;
  }

  var c = $this.attr('class').match(/(one|two|three|four|five)/);
  var $dl = $this.closest('dl');
   
  $dl.find('dt').removeClass('active');
  $this.addClass('active');
  $dl.find('dd').hide();
  $dl.find('dd.' + c[1]).fadeIn();
 });

 $('.slider').bind('mouseenter', function(e) {
  if (timer != null) {
   window.clearInterval(timer);
   timer = null;
  }
 }).bind('mouseleave', function(e) {
  
  var $this = $(this);

  if (timer == null) {
   timer = window.setInterval(function() {
    var $e = $this.find('.active').nextAll('dt').eq(0);
    if ($e.length == 0) {
     $e = $this.find('dt:eq(0)');
    }
    $e.trigger('activate');
   }, 3 * 1200);
  }
 }).trigger('mouseleave');
});
